<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <span id="spanId">Hello Span</span> <br>
    <button onclick="clickMe()">点击</button>

    <script>
        function clickMe() {
            var spanObj = document.getElementById('spanId');
            //spanObj.innerText = '<h1 style="color: red">innerText</h1>';
            spanObj.innerHTML = '<h1 style="color: red">innerText</h1>';

            var random = parseInt(Math.random() * 100 + 1);
            console.log(random);
        }
    </script>
</body>
</html>